<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="transacao" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{transacaoHome.managed ? 'Edit' : 'Add'} Transacao</f:facet>



            <s:decorate id="contaIdContaField" template="layout/edit.xhtml">
                <ui:define name="label">Conta id conta</ui:define>
                <h:inputText id="contaIdConta"
                       required="true"
                          value="#{transacaoHome.instance.contaIdConta}">
                    <a:support event="onblur" reRender="contaIdContaField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="usuarioIdUsuarioField" template="layout/edit.xhtml">
                <ui:define name="label">Usuario id usuario</ui:define>
                <h:inputText id="usuarioIdUsuario"
                       required="true"
                          value="#{transacaoHome.instance.usuarioIdUsuario}">
                    <a:support event="onblur" reRender="usuarioIdUsuarioField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


            <s:decorate id="dataField" template="layout/edit.xhtml">
                <ui:define name="label">Data</ui:define>
                <rich:calendar id="data"
                       required="true"
                          value="#{transacaoHome.instance.data}" datePattern="MM/dd/yyyy" />
            </s:decorate>


            <s:decorate id="historicoField" template="layout/edit.xhtml">
                <ui:define name="label">Historico</ui:define>
                <h:inputTextarea id="historico"
                               cols="80"
                               rows="3"
                           required="true"
                              value="#{transacaoHome.instance.historico}"/>
            </s:decorate>


            <s:decorate id="valorField" template="layout/edit.xhtml">
                <ui:define name="label">Valor</ui:define>
                <h:inputText id="valor"
                       required="true"
                          value="#{transacaoHome.instance.valor}"
                           size="17">
                    <a:support event="onblur" reRender="valorField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>


           

            <s:decorate id="datacriacaoField" template="layout/edit.xhtml">
                <ui:define name="label">Datacriacao</ui:define>
                <rich:calendar id="datacriacao"
                       required="true"
                          value="#{transacaoHome.instance.datacriacao}" datePattern="MM/dd/yyyy" />
            </s:decorate>

            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{transacaoHome.persist}"
                       disabled="#{!transacaoHome.wired}"
                       rendered="#{!transacaoHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{transacaoHome.update}"
                       rendered="#{transacaoHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{transacaoHome.remove}"
                      immediate="true"
                       rendered="#{transacaoHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/Transacao.xhtml"
                rendered="#{transacaoHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty transacaoFrom ? 'TransacaoList' : transacaoFrom}.xhtml"
                rendered="#{!transacaoHome.managed}"/>

        </div>
    </h:form>

</ui:define>

</ui:composition>
